package com.ittest.service.impl.rabbitmq.direct.config;



import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class RabbitConfigDirect {


    //消息队列
    @Bean
    public Queue dircetqueue(){
        return new Queue("direct_queue");
    }
    //消息队列2
    @Bean
    public Queue dircetqueue2(){
        return new Queue("direct_queue2");
    }

    //交换机
    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("directExchange");
    }

    @Bean
    //将交换机和消息队列绑定
    public Binding bindingDricet(){
        return BindingBuilder.bind(dircetqueue()).to(directExchange()).with("direct");
    }
    @Bean
    //将交换机和消息队列绑定
    public Binding bindingDricet2(){
        return BindingBuilder.bind(dircetqueue2()).to(directExchange()).with("direct2");
    }

}
